package com.cyy;

import com.cyy.ba02.School;
import com.cyy.ba02.Student;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class MyTest02 {

    //测试spring的使用
    @Test
    public void test01(){
        String config = "ba02/applicationContext.xml";
        ApplicationContext  ac = new ClassPathXmlApplicationContext(config);
        //从容器中获取Student对象
        Student myStudent = (Student) ac.getBean("myStudent");
        System.out.println("student对象="+myStudent);
    }

    @Test
    public void test02(){
        System.out.println("===test02===");
        Student student = new Student();
        student.setName("陈艺阳");
        student.setAge(20);

        School school = new School();
        school.setName("南昌理工");
        school.setAddress("南昌");
        student.setSchool(school);
        System.out.println("student=="+student);
    }

}
